package com.lkm.app_ui;

import android.os.Environment;

import com.lkm.app_ui.ui.fj.FjOrder;
import com.lkm.frame.file.FileSystem;
import com.lkm.market2_0.m.steelyarddata.OrderEntity;

import java.io.File;

public class AppConfig {

    public  static boolean isUpImgIn4G = false;



    public static boolean isLowseNet(){
        return true;
    }

    public static boolean isOrderImgTack(){
        return true;
    }
    public static void setisUserIn4g(boolean isLowseNet_){
    }



    public static boolean isOrderImgToMe = false;

    public static boolean isOrderImgToSZ = false;








//            return AppConfig.DataFile.systemDataFileDir + NAME;









//            return AppConfig.DataFile.systemDataFileDir + NAME;





    public static class DataFile {



        public synchronized static void init(){

            AppConfig.DataFile.dataDir = FileSystem.getRederPath(FileSystem.FileLocal.ExternalFilesDir, "data", MyApplication.application);


            //        /sdcard/Android/data/mark.satrace.cn/files/orderTempFile
            AppConfig.DataFile.orderTempFile = FileSystem.getRederPath(FileSystem.FileLocal.ExternalFilesDir, "orderTempFile", MyApplication.application);

            AppConfig.DataFile.orderImgTempFileDir = FileSystem.getRederPath(FileSystem.FileLocal.Sdcard, "orderImgTemps", AppConst.getApplication());

            AppConfig.DataFile.orderImgUpFileDir = FileSystem.getRederPath(FileSystem.FileLocal.Sdcard, "orderImgUps", AppConst.getApplication());

            AppConfig.DataFile.orderImgUpSZFileDir = FileSystem.getRederPath(FileSystem.FileLocal.Sdcard, "orderImgUpSZs", AppConst.getApplication());

            AppConfig.DataFile.orderCacheUpSZFileDir = FileSystem.getRederPath(FileSystem.FileLocal.Sdcard, "orderCacheUpSZs", AppConst.getApplication());

            fjImgUpFileDir = FileSystem.getRederPath(FileSystem.FileLocal.Sdcard, "fjImgUpFileDir", AppConst.getApplication());

            AppConfig.DataFile.shardInfoDir = Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator
                    + "ast-shard" + File.separator;


        }

        public static String shardInfoDir = "";
        public static String getShardInfoDir(String packageName) {
            return AppConfig.DataFile.shardInfoDir + packageName+"/";
        }

        public static String getDeviceUncodePath() {
            return shardInfoDir  + "uncode";
        }


        public static String orderImgTempFileDir = "";







        private static String dataDir = "";

        public static String getDataFile(String fileName){
            return dataDir + fileName;
        }


        public static String orderTempFile = "";



        public static String orderImgUpFileDir = "";



        public static String orderImgUpSZFileDir = "";



        public static String orderCacheUpSZFileDir = "";




        public static String fjImgUpFileDir = "";


        public static String getOrderImgTempFilePath(OrderEntity.GoodEntity goodEntity){

            return AppConfig.DataFile.orderImgTempFileDir +goodEntity.itemId+".jpg";
        }


        public static String toFjImgUpFilePath(FjOrder.FjItem goodEntity){


//                date = goodEntity.createTime.substring(0, 10).replaceAll("-", "").replace(".","");


            String img_on = goodEntity.fjInfoNo+"-"+goodEntity.id+".jpg";
//            String img_on = goodEntity.fjInfoNo+"#"+goodEntity.id+".jpg";
            goodEntity.img_on = img_on;

//            return AppConfig.DataFile.fjImgUpFileDir + date+"-"+ img_on;//orderEntity.orderNum+"#"+goodEntity.itemId+".jpg";

            return AppConfig.DataFile.fjImgUpFileDir +  img_on;
        }



        public static String getOrderImgUpFilePath(OrderEntity orderEntity, OrderEntity.GoodEntity goodEntity){
            String date = "";
            try {
                date = orderEntity.createTime.substring(0, 10).replaceAll("-", "");
            }catch (Exception e){}

            return AppConfig.DataFile.orderImgUpFileDir + date+"-"+ goodEntity.img_on;//orderEntity.orderNum+"#"+goodEntity.itemId+".jpg";
        }



        public static String getOrderImgUpSZFilePath(OrderEntity orderEntity,OrderEntity.GoodEntity goodEntity){


//                date = orderEntity.createTime.substring(0, 10).replaceAll("-", "");


//            return AppConfig.DataFile.orderImgUpSZFileDir + date+"-"+ goodEntity.img_on;//orderEntity.orderNum+"#"+goodEntity.itemId+".jpg";

            return getOrderImgUpSZFilePath(orderEntity.createTime, goodEntity.img_on);
        }
        public static String getOrderImgUpSZFilePath(String orderCreateTime,String goodimg_on){
            String date = "";
            try {
                date = orderCreateTime.substring(0, 10).replaceAll("-", "");
            }catch (Exception e){}

            return AppConfig.DataFile.orderImgUpSZFileDir + date+"-"+ goodimg_on;//orderEntity.orderNum+"#"+goodEntity.itemId+".jpg";
        }

        public static String getOrderImgUpFilePath(String img){
            return AppConfig.DataFile.orderImgUpFileDir+ img;
        }
        public static String getFjImgUpFilePath(String img){
            return AppConfig.DataFile.fjImgUpFileDir + img;
        }
        public static String getOrderImgUpSZFilePath(String img){
            return AppConfig.DataFile.orderImgUpSZFileDir+ img;
        }




    }

}
